/**
 * API响应类型定义
 */

// 通用响应类型
export interface ApiResponse<T = any> {
  success: boolean
  message: string
  data: T
  timestamp: string
}

// 分页响应类型
export interface PaginatedResponse<T = any> {
  success: boolean
  message: string
  data: T[]
  pagination: {
    page: number
    limit: number
    total: number
    totalPages: number
  }
  timestamp: string
}

// 地点状态枚举
export enum LocationStatus {
  PENDING = 'PENDING',
  APPROVED = 'APPROVED',
  REJECTED = 'REJECTED'
}

// 时段枚举
export enum TimePeriod {
  BREAKFAST = 'BREAKFAST',
  LUNCH = 'LUNCH',
  DINNER = 'DINNER',
  OTHER = 'OTHER'
}

// 用户角色枚举
export enum UserRole {
  ADMIN = 'ADMIN',
  USER = 'USER'
}

// 地点类型
export interface Location {
  id: number
  name: string
  coordinateX: number
  coordinateY: number
  status: LocationStatus
  creatorId: number
  adminNote?: string | null
  creator?: {
    id: number
    nickname: string
    avatarUrl: string | null
  }
  avgRating: number
  ratingsCount: number
  dishesCount: number
  createdAt: string
  updatedAt: string
}

// 用户类型
export interface User {
  id: number
  openid: string
  unionid: string | null
  username: string | null
  nickname: string | null
  avatarUrl: string | null
  role: UserRole
  createdAt: string
  updatedAt: string
}

// 评分类型
export interface Rating {
  id: number
  locationId: number
  location?: Location
  userId: number
  user?: User
  score: number
  createdAt: string
  updatedAt: string
}

// 推荐菜品类型
export interface RecommendedDish {
  id: number
  locationId: number
  location?: Location
  userId: number
  user?: User
  dishName: string
  floor: string | null
  price: number | null
  imageUrl: string | null // 菜品图片URL（相对路径）
  createdAt: string
}

// 拥挤度类型
export interface CongestionLevel {
  id: number
  locationId: number
  timePeriod: TimePeriod
  level: number
  updatedAt: string
}

// 地点查询参数
export interface LocationQueryParams {
  status?: LocationStatus
  page?: number
  limit?: number
}

// 地点创建/更新参数
export interface LocationFormData {
  name: string
  coordinateX: number
  coordinateY: number
  adminNote?: string
}

// 用户查询参数
export interface UserQueryParams {
  role?: UserRole
  page?: number
  limit?: number
}

// 评分查询参数
export interface RatingQueryParams {
  locationId?: number
  userId?: number
  page?: number
  limit?: number
}

// 推荐菜品查询参数
export interface DishQueryParams {
  locationId?: number
  page?: number
  limit?: number
}
